#ifndef GROUPBY_H
#define GROUPBY_H

#include <vector>
#include <string>
#include "columnReference.h"

using namespace std;

/*
    Class: GroupBy
    Represents a list of column references for a Group By clause in a SQL query.
*/
class GroupBy
{
    /* Section: public */
    public:
        /*
            Destructor: Default destructor.
            Destroy the object.
        */
        virtual ~GroupBy();

        /*
            Constructor: Copy constructor.
            Initializes the object as a copy of other GroupBy object.

            Parameters:
                other - GroupBy object to copy from.
        */
        GroupBy(const GroupBy& other);

        /*
            Contructor: Parametrized constructor.
            Initializes the object with the given parameters.

            Parameters:
                column_references - vector of Columns of the GroupBy.
        */
        GroupBy(vector<ColumnReference *> * column_references = NULL);

        /*
            Method: getColumnReferences
            Returns:
                A pointer to the vector of column references of the object

            See also:
                <ColumnReference>
        */
        vector<ColumnReference *> * getColumnReferences() ;

        /*
            Method: addColumnReference
            Adds a new ColumnReference to the ColumList as a clone of the ColumnReference given.

            Parameters:
                columnReference - ColumnReference to add.

            See also:
                <ColumnReference>
        */
        void addColumnReference(ColumnReference * columnReference);

        /*
            Method: addColumn
            Adds a new columnReference to the ColumList.

            Parameters:
				table - Name of the table or view of the column reference 
                column - Name of the column of the column reference
        */
        void addColumnReference(const string & table, const string & column);

        /*
            Method: setColumnReferences
            Sets the column references of the GroupBy. Delete the previous if any.

            Parameters:
                column_references - vector of Columns
        */
        void setColumnReferences(vector<ColumnReference *> * columns);

        /*
            Method: size
            Returns:
                Number of column references of the GroupBy.
        */
        virtual int size();

        /*
            Method: toString
            Returns:
                A string representation of the columnReference list.
        */
        string toString();

        /*
            Method: clone
            Returns:
                A clone of this object.
        */
        GroupBy * clone();

    /* Section: private */
    private:
        /*
            Variable: columnReferences
            Type: vector<ColumnReference *> *
            List of column references.

            See also:
                <ColumnReference>
        */
        vector<ColumnReference *> * columnReferences;
};

#endif // GROUPBY_H
